<?php

namespace App\Services\ContractSign\Drivers;

use App\Services\ContractSign\ContractSignResult;
use App\Services\ContractSign\ContractSigner;
use Illuminate\Support\Facades\Log;

class LogContractSigner implements ContractSigner
{
    protected array $config;

    public function __construct(array $config = [])
    {
        $this->config = $config;
    }

    public function applySign(array $params): ContractSignResult
    {
        Log::info('[ContractSign][Log] mock applySign', [
            'params' => $params,
        ]);

        return ContractSignResult::success([
            'applyNo' => uniqid('CONTRACT_'),
            'signUrl' => 'https://example.com/contract-sign/mock',
        ], '模拟合同签署链接生成成功', [
            'mock' => true,
        ]);
    }

    public function fetchContractDocument(string $applyNo): ContractSignResult
    {
        Log::info('[ContractSign][Log] mock fetchContractDocument', [
            'applyNo' => $applyNo,
        ]);

        return ContractSignResult::success([
            'downloadUrl' => sprintf('https://example.com/contracts/%s.pdf', $applyNo),
        ], '模拟合同下载链接生成成功', [
            'mock' => true,
        ]);
    }
}
